host: Add indexing drain after restoring cached realm - #5796
Draft
backspace wants to merge 5 commits into
Draft
Conversation
A restored index does not stop the realm indexing. Each test's adapter stamps its fixtures with the current second while the restored rows carry the first test's, and `discover-invalidations` compares those for equality, so `realm.start()` invalidates the lot and re-indexes. The work is cheap — the snapshot also restored the transpile and prerender caches — but it is asynchronous, and a test that reads index-derived state races it. That is how `ai-assistant`'s code-mode test lost the cursor position it clicks a definition to reach: the lookup ran while indexing was still in flight. So settle the realms before returning, the way setupLocalIndexing's afterEach already does between tests. Deliberately not fixed by making the mtimes match. That comparison is what rebuilds the index when a module's fixtures diverge from its snapshot under an unchanged cache key — the only protection this helper has against silently serving the wrong fixtures. Content-derived mtimes would keep the protection in principle, but fixture content includes live card instances that are serialized later and carry a per-construction id, so they cannot be hashed at construction. ai-assistant moves back to the shared cache here, so the run either proves the drain fixes that race or says the diagnosis was wrong. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Preview deploymentsHost Test Results 1 files ± 0 1 suites ±0 10m 23s ⏱️ - 1h 12m 39s Results for commit 0e0899f. ± Comparison against earlier commit a784f43. Realm Server Test Results 1 files ±0 1 suites ±0 14m 10s ⏱️ - 2m 3s Results for commit 0e0899f. ± Comparison against earlier commit a784f43. |
`code mode context sent with message` failed this assertion on CI with no way to see what it got: the TAP reporter renders a failed deepEqual's operands as `[object Object]`, and a shard that fails uploads no test-report artifact to read them from. Put the value in the message. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The failing one turned out to be a later stage of the same test — it asserts three times, against a cursor position and then a selection in plant.gts, and only the first was instrumented. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Wrapping the realm setup in `withCachedRealmSetup` indented its body, and that carried into the template literals holding plant.gts and broken-card.gts — template-literal content is data, so every line of those modules gained two leading spaces. `code mode context sent with message` asserts the cursor position that clicking a definition produces, which is derived from the module source, so it moved with the fixture: the instrumented message reported column 47 against an expected 45. Restore both fixtures to the bytes main has. The expectations were right; the fixtures had silently changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
They named the value that identified the shifted fixture; the assertions go back to their plain messages now that the cause is fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude: A restored index does not stop the realm indexing. Each test's adapter stamps its fixtures with the current second while the restored rows carry the first test's, and
discover-invalidationscompares those for equality, sorealm.start()invalidates the lot and re-indexes. The work is cheap — the snapshot also restored the transpile and prerender caches — but it is asynchronous, and a test that reads index-derived state races it. That is howai-assistant's code-mode test lost the cursor position it clicks a definition to reach: the lookup ran while indexing was still in flight.So settle the realms before returning, the way setupLocalIndexing's afterEach already does between tests.
Deliberately not fixed by making the mtimes match. That comparison is what rebuilds the index when a module's fixtures diverge from its snapshot under an unchanged cache key — the only protection this helper has against silently serving the wrong fixtures. Content-derived mtimes would keep the protection in principle, but fixture content includes live card instances that are serialized later and carry a per-construction id, so they cannot be hashed at construction.
ai-assistant moves back to the shared cache here, so the run either proves the drain fixes that race or says the diagnosis was wrong.